﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace XC.Keys
{
    /// <summary>
    /// 密钥信息
    /// </summary>
    [Serializable]
    public class KeyInfoBase : INotifyPropertyChanged
    {
        /// <summary>
        /// 密钥信息
        /// </summary>
        public KeyInfoBase()
        {
        }

        private string customerCode { get; set; }


        private string machineCode { get; set; } = "AAAAAA";

        private DateTime startDate { get; set; } = DateTime.Now;

        private DateTime endDate { get; set; } = DateTime.Now.AddMonths(1);

        private string manufacturerCode { get; set; } = "666";

        private string manufacturerName { get; set; } = "杭州芯创智联";

        private string version { get; set; }

        public string CustomerCode
        {
            get => customerCode; set
            {

                customerCode = value;
                Changed();
            }
        }

        public string MachineCode
        {
            get => machineCode; set
            {
                machineCode = value;
                Changed();
            }
        }

        public DateTime StartDate
        {
            get => startDate; set
            {

                startDate = value;
                Changed();
            }
        }

        public DateTime EndDate
        {
            get => endDate; set
            {
                endDate = value;
                Changed();
            }
        }

        public string ManufacturerCode
        {
            get => manufacturerCode; set
            {
                manufacturerCode = value;
                Changed();
            }
        }

        public string ManufacturerName
        {
            get => manufacturerName; set
            {
                manufacturerName = value; Changed();
            }
        }

        public string Version
        {
            get => version; set
            {

                version = value;
                Changed();
            }
        }




        /// <summary>
        /// 属性被修改
        /// </summary>

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// 扩展信息被修改
        /// </summary>
        public void Changed([CallerMemberName] string name = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(name)));
        }
    }

}
